package com.ruoyi.basic.service.impl;

import com.ruoyi.basic.domain.MaterialCategory;
import com.ruoyi.basic.mapper.MaterialCategoryMapper;
import com.ruoyi.basic.service.IMaterialCategoryService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 物料类别Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-08-13
 */
@Service
public class MaterialCategoryServiceImpl implements IMaterialCategoryService 
{
    @Autowired
    private MaterialCategoryMapper materialCategoryMapper;

    /**
     * 查询物料类别
     * 
     * @param macId 物料类别主键
     * @return 物料类别
     */
    @Override
    public MaterialCategory selectMaterialCategoryByMacId(Long macId)
    {
        return materialCategoryMapper.selectMaterialCategoryByMacId(macId);
    }

    /**
     * 查询物料类别列表
     * 
     * @param materialCategory 物料类别
     * @return 物料类别
     */
    @Override
    public List<MaterialCategory> selectMaterialCategoryList(MaterialCategory materialCategory)
    {
        return materialCategoryMapper.selectMaterialCategoryList(materialCategory);
    }

    /**
     * 新增物料类别
     * 
     * @param materialCategory 物料类别
     * @return 结果
     */
    @Override
    public int insertMaterialCategory(MaterialCategory materialCategory)
    {
        materialCategory.setCreateTime(DateUtils.getNowDate());
        return materialCategoryMapper.insertMaterialCategory(materialCategory);
    }

    /**
     * 修改物料类别
     * 
     * @param materialCategory 物料类别
     * @return 结果
     */
    @Override
    public int updateMaterialCategory(MaterialCategory materialCategory)
    {
        materialCategory.setUpdateTime(DateUtils.getNowDate());
        return materialCategoryMapper.updateMaterialCategory(materialCategory);
    }

    /**
     * 批量删除物料类别
     * 
     * @param macIds 需要删除的物料类别主键
     * @return 结果
     */
    @Override
    public int deleteMaterialCategoryByMacIds(Long[] macIds)
    {
        return materialCategoryMapper.deleteMaterialCategoryByMacIds(macIds);
    }

    /**
     * 删除物料类别信息
     * 
     * @param macId 物料类别主键
     * @return 结果
     */
    @Override
    public int deleteMaterialCategoryByMacId(Long macId)
    {
        return materialCategoryMapper.deleteMaterialCategoryByMacId(macId);
    }
}
